# coding: utf-8
from . import db, BaseModel

from .consulter import Consulter
from .reservation import Reservation




class ReservationConsulter(db.Model):
    __tablename__ = 'reservation_consulter'

    auto_id = db.Column(db.BigInteger, primary_key=True, info='自增id')
    con_id = db.Column(db.ForeignKey('consulter.con_id'), index=True, info='咨询者id')
    re_id = db.Column(db.ForeignKey('reservation.re_id'), index=True, info='预约id')
    status = db.Column(db.Integer, info='状态')
    is_saved = db.Column(db.Integer, server_default=db.FetchedValue(), info='是否收藏 1-是 0-否')
    is_delete = db.Column(db.Integer, server_default=db.FetchedValue(), info='是否已删除 1-是 0-否')
    create_time = db.Column(db.DateTime, server_default=db.FetchedValue(), info='创建时间')
    update_time = db.Column(db.DateTime, server_default=db.FetchedValue(), info='更新时间')

    con = db.relationship('Consulter', primaryjoin='ReservationConsulter.con_id == Consulter.con_id', backref='reservation_consulters')
    re = db.relationship('Reservation', primaryjoin='ReservationConsulter.re_id == Reservation.re_id', backref='reservation_consulters')
